package com.mc.code.service.Impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.mc.code.entity.CodeItems;
import com.mc.code.entity.CodeUsers;
import com.mc.code.mapper.ItemsMapper;
import com.mc.code.mapper.LoginMapper;
import com.mc.code.service.ItemsService;
import com.mc.code.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ItemsImpl implements ItemsService {
    @Autowired
    private ItemsMapper itemsMapper;


    @Override
    public List<CodeItems> items(int num) {
        return itemsMapper.items(num);
    }

    @Override
    public List<CodeItems> itemsDetails(int itemNo) {
        return itemsMapper.itemsDetails(itemNo);
    }

//    查询当前项目阶段
    @Override
    public int itemsStageNum(Integer itemNo) {
        return itemsMapper.itemsStageNum(itemNo);
    }

//    查看当前项目总阶段
    @Override
    public int itemsTotalNum(Integer itemNo) {
        return itemsMapper.itemsTotalNum(itemNo);
    }

//    返回项目最大id数
    @Override
    public int itemsEndNo() {
    return  itemsMapper.itemsEndNo();
    }


//    返回是否收藏项目数
    @Override
    public Integer collection(int userNo,int itemNo) {
        return itemsMapper.collection(userNo,itemNo);
    }


//    取消收藏项目
    @Override
    public void delCollection(int itemNo, int userNo) {
        itemsMapper.delCollection(itemNo,userNo);


    }

    @Override
    public void addCollection(int itemNo, int userNo) {
        itemsMapper.addCollection(itemNo,userNo);
    }

    @Override
    public int collectionNum(Integer itemNo) {
        return itemsMapper.collectionNum(itemNo);
    }

    @Override
    public void releaseProject(CodeItems codeItems) {
        itemsMapper.releaseProject(codeItems);
    }

    @Override
    public List<CodeItems> collectItems(String userNo) {
        return itemsMapper.collectItems(userNo);
    }

    @Override
    public Page<CodeItems> selectItemslist(Page<CodeItems> page) {
        return page.setRecords(itemsMapper.selectItemslist(page));
    }


}
